# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=swc
pkgver=1.3.100
pkgrel=0
pkgdesc="A super-fast TypeScript / JavaScript compiler written in Rust"
url="https://swc.rs"
# riscv64: it would take eternity to build
arch="all !riscv64"
license="Apache-2.0"
makedepends="cargo cargo-auditable"
source="https://github.com/swc-project/swc/archive/v$pkgver/swc-$pkgver.tar.gz"
builddir="$srcdir/$pkgname-$pkgver/bindings"
# !check: TODO: run tests
# net: fetch dependencies
options="!check net"

prepare() {
	default_prepare

	# This is unwanted and breaks build on ARM.
	rm ../.cargo/config.toml

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build -p swc_cli --release --locked
}

package() {
	install -D -m755 target/release/swc -t "$pkgdir"/usr/bin/
}

sha512sums="
f6351484ff82c39000846213dc67e3f31dcc91992e680aaaaed55e160119b85a3957d9bdfb62ca3df9cad91fedb2093fb2001e376e1de78d8c8b70a8d99e5edf  swc-1.3.100.tar.gz
"
